<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.model.Building" %>  
<%@ page import="com.model.Admin" %>  
<%@ page import="com.control.BuildingControl" %>  
<%@ page import="com.control.AdminControl" %>  
<%@ page import="java.util.ArrayList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>insertInformation.jsp</title>
		<script language="javascript"> 
		function check1()
		{
			    if(document.form1.number.value=="")
				{
					alert("账号不能为空");
					document.form1.name.focus();
					return;
				}
				else if(document.form1.name.value=="")
				{
					alert("姓名不能为空");
					document.form1.number.focus();
					return;
				}
				else if(document.form1.password.value=="")
				{
					alert("密码不能为空");
					document.form1.password.focus();
					return;
				}
				else
				{form1.submit();}
		}
		function   IsNum(theField) 
		   {  
		     if   (!IsNum2(theField.value)) 
		       {
			       alert( "该区域只能输入数字！请重新填写  "); 
		           theField.value   = " "; 
		           theField.focus();
		       } 
		    } 
</script>
	</head>
	<body>
	<%
	request.setCharacterEncoding("UTF-8");
	int admin_id=Integer.parseInt(request.getParameter("id"));
	Admin a=new Admin();
	AdminControl ac = new AdminControl();
	a = ac.getAdmin(admin_id);
	%>
		<fieldset class="filedset">
			<legend>
				修改管理员信息
			</legend>
			<form action="adminInfo_change_deal.jsp?id=<%=admin_id %>" name="form1" method="post"
				style="margin-top: 20px; margin-left: 400px;">
				<span style="color: #376ba5; margin-top: 10px;">账&nbsp;号：</span>
				<input name="number" type="text" id="number" value=<%=a.getAdmin_num() %>
					style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">密&nbsp;码：</span>
				<input name="password"  type="text" id="password" value=<%=a.getAdmin_pwd() %>
					 style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">姓&nbsp;名：</span>
				<input name="name" type="text" id="name" value=<%=a.getAdmin_name() %>
					style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">性&nbsp;别：</span> 
				<select name="sex" id="sex" style="margin-top:10px">
				<option value="男" <%if(a.getAdmin_sex().equals("男")) %>selected="selected" >男</option>
				<option value="女" <%if(a.getAdmin_sex().equals("女")) %>selected="selected">女</option>
				</select>	
				<br />
				<span style="color: #376ba5; margin-top: 10px;">
				电&nbsp;话：
				</span>
				<input name="tel" type="text" id="tel" onblur=IsNum(this) value=<%=a.getAdmin_tel() %>
					style="margin-top: 10px;">
				<br />
				<span style="color: #376ba5; margin-top: 10px;">寝室楼:</span>
										<select name="building" size="1"  style="margin-top: 10px;">
										<%
											BuildingControl control = new BuildingControl();
											ArrayList<Building> list = new ArrayList<Building>();
											list = control.getBuildingList(); 
											for(int i=0; i<list.size(); i++) {
												Building building = list.get(i);
										%>
										<option value="<%= building.getBuilding_id() %>" <%if(a.getAdmin_building_id() == building.getBuilding_id()%><%){%>selected="selected"<%}%>><%=building.getBuilding_name() %></option>
										<%}%>
										</select><br/>
				<input type="submit" value="确定" onclick="check1()"
					style="background: url(../../images/button.gif) no-repeat; margin-left: 40px; border: 0px; height: 28px; width: 62px; margin-top: 20px;" />
				<input name="input" type="reset" value="重置"
					style="background: url(../../images/button.gif) no-repeat; margin-left: 20px; border: 0px; height: 28px; width: 62px; margin-top: 20px;" />
			</form>
		</fieldset>
	</body>
</html>